<SCRIPT LANGUAGE="JavaScript">  
    function validation()
    {
        var temp="";
        var alpha = /^[a-zA-Z0-9-_]*$/;
        
        temp=document.getElementById('EmployerOldPassword');
        if( temp.value.length < 6 || temp.value.length > 20 || !alpha.test(temp.value))
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Password must be between 6 to 20 alphanumeric characters');
            temp.style.backgroundColor='#FFF';
            return false;             
        }        

        temp=document.getElementById('EmployerPassword');
        if( temp.value.length < 6 || temp.value.length > 20 || !alpha.test(temp.value))
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Password must be between 6 to 20 alphanumeric characters');
            temp.style.backgroundColor='#FFF';
            return false;             
        }        

        if( temp.value!=document.getElementById('EmployerPassword2').value )
        {
            document.getElementById('EmployerPassword2').focus();
            document.getElementById('EmployerPassword2').style.backgroundColor='#FFC';
            alert("Your Confirm Password doesn't match");
            document.getElementById('EmployerPassword2').style.backgroundColor='#FFF';
            return false;             
        }
        
        if(temp.value==document.getElementById('EmployerOldPassword').value)
        {   
            document.getElementById('EmployerPassword').focus();
            document.getElementById('EmployerPassword').style.backgroundColor='#FFC';
            alert("You must fill diffrent value with your old password ");
            document.getElementById('EmployerPassword').style.backgroundColor='#FFF';
            return false;            
        }

   }        
        

</SCRIPT>
    
<?php 
echo "<div class='form'>";
echo "<h2> Change Password </h2>";
echo "<hr color='#2A7EF7'>"; 
    echo "<div class='kotak2'>";
    echo $form->create('Employer',array('action'=>'change_password','onsubmit'=>'return validation();'));
        echo $form->input('old_password',array ('label'=>'Old Password', 'type'=>'password', 'maxLength'=>'20', 'after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('password',array ('label'=>'New Password', 'maxLength'=>'20', 'after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('password2',array ('label'=>'Confirm New Password', 'type'=>'password', 'maxLength'=>'20', 'after'=>"<span class='red'><sup>*</sup></span>"));
        echo "<div class='input'><label >".$html->link('[ Back ]',array('controller'=>'employers','action'=>'edit_account'))."</label><input type='submit' value='Save'></center></div>"; 
    echo "</form>"; 
    echo "</div>";    
    echo ":. <span class='red'>*</span> Required Field";
echo "</div>";
?>
                                